﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;

namespace SimpleForum.Data.Models
{
    [MetadataType(typeof(CategoryMetaData))]
    public partial class Category
    {
        public IEnumerable<Forum> ParentForums
        {
            get
            {
                return this.Forums.Where(x => x.ParentForumId == null);
            }
        }
    }

    public class CategoryMetaData
    {
        [ScaffoldColumn(false)]
        public int Id { get; set; }

        [Required]
        [StringLength(50, MinimumLength=5)]
        public string Name { get; set; }
    }
}